package 多线程.复习.创建线程的方法;

public class MoreThreadSpeed {
    static long x = 0;
    static long y = 0;
    public static void main(String[] args) throws InterruptedException {
        fun();
        fun1();
    }
    public static void fun() throws InterruptedException {
        Thread t1 = new Thread(() ->{
            for (int i = 0; i < 5000_0000_0; i++) {
                x++;
            }
        });
        for (int i = 0; i < 5000_0000_0; i++) {
            x++;
        }
        long start = System.currentTimeMillis();
        t1.start();
        t1.join();
        long end = System.currentTimeMillis();
        System.out.println(end - start + " " +x);
    }
    public static void fun1(){
        long start = System.currentTimeMillis();
        for (int i = 0;i < 1000_0000_00;i++){
            y++;
        }
        long end = System.currentTimeMillis();
        System.out.println(end - start + " " +y);
    }
}
